package com.qiyi.cupid.adplayer.base
{
   public class Log extends Object
   {
      
      public function Log() {
         super();
      }
      
      public static const INFO:String = "INFO";
      
      public static const WARN:String = "WARN";
      
      public static const ERROR:String = "ERROR";
      
      public static const DEBUG:String = "DEBUG";
      
      private static var _logs:Array = new Array();
      
      public static function info(param1:String) : void {
         var _loc2_:String = [getLogTime(),"[" + INFO + "]",param1].join(" ");
         Debug.log(_loc2_);
         log(_loc2_);
      }
      
      public static function warn(param1:String) : void {
         var _loc2_:String = [getLogTime(),"[" + WARN + "]",param1].join(" ");
         Debug.warning(_loc2_);
         log(_loc2_);
      }
      
      public static function error(param1:String) : void {
         var _loc2_:String = [getLogTime(),"[" + ERROR + "]",param1].join(" ");
         Debug.error(_loc2_);
         log(_loc2_);
      }
      
      public static function debug(param1:String) : void {
         var _loc2_:String = [getLogTime(),"[" + DEBUG + "]",param1].join(" ");
         Debug.log(_loc2_);
      }
      
      public static function object(param1:String, param2:*) : void {
         var _loc4_:String = null;
         var _loc5_:String = null;
         var _loc3_:String = [getLogTime(),"[" + INFO + "]",param1].join(" ");
         Debug.log(_loc3_);
         log(_loc3_);
         for(_loc4_ in param2)
         {
            _loc5_ = [_loc4_,":",param2[_loc4_]].join(" ");
            Debug.log(_loc5_);
            log(_loc5_);
         }
      }
      
      private static function log(param1:String) : void {
         _logs.push(param1);
         if(_logs.length > 3000)
         {
            _logs.shift();
         }
      }
      
      public static function getLogs() : Array {
         return _logs;
      }
      
      private static function getLogTime() : String {
         var _loc1_:String = null;
         var _loc2_:Date = new Date();
         _loc1_ = _loc2_.getMonth() + 1 + "/" + _loc2_.getDate() + "/" + _loc2_.getFullYear() + " " + padTime(_loc2_.getHours()) + ":" + padTime(_loc2_.getMinutes()) + ":" + padTime(_loc2_.getSeconds()) + "." + padTime(_loc2_.getMilliseconds(),true);
         return _loc1_;
      }
      
      private static function padTime(param1:Number, param2:Boolean = false) : String {
         if(param2)
         {
            if(param1 < 10)
            {
               return "00" + param1.toString();
            }
            if(param1 < 100)
            {
               return "0" + param1.toString();
            }
            return param1.toString();
         }
         return param1 > 9?param1.toString():"0" + param1.toString();
      }
   }
}
